package com.example.java.kafka.es7client;

import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.RequestOptions;

public class GetDoc {
    public static void main(String[] args) {
        ConnectElasticsearch.connect(client -> {
            // 创建请求对象
            GetRequest request = new GetRequest().index("user").id("1001");
            // 客户端发送请求，获取响应对象
            GetResponse response = client.get(request, RequestOptions.DEFAULT);
            // 打印结果信息
            System.out.println("Result: " + response);
        });
    }
}